<%@ include file="../confHeader.jsp" %>
<%@ include file="../mensagens.jsp" %>
<html>
<head>
	
</head>
<body>

 <html:javascript formName="GruposForm" />  
 <html:form  action="gruposAction.do?method=gravar"  method="POST"  onsubmit="return validateGruposForm(this);">
   <div class='pageForm'>
   <html:hidden property="idGrupo" />
   <html:hidden property="nivel" value="${to.nivel}" />
      <div class='formTitle'>      
	        <logic:equal value="true"  name="to" property="update" >
	       		<bean:message key="app.form.update"/>&nbsp;<bean:message key="${form_title}"/>
	       </logic:equal>
	       <logic:notEqual value="true"  name="to"  property="update">
		       	<bean:message key="app.form.create"/>&nbsp;<bean:message key="${form_title}"/>
	       </logic:notEqual>

      </div>       
        <div class='formField'>
            <label><bean:message key="grupo.nome"/></label>
            <html:text  property="nome" size="50" maxlength="255"  />
        </div>      
        <div class='formField'>
         <label><bean:message key="grupo.descricao"/></label> <br>
               <html:textarea   property="descricao"  rows="7" cols="60" onkeypress="javascript:limitLength(this,500)" 
               onkeyup="javascript:limitLength(this,500)" />
        </div>           
        <logic:equal name="to" property="temPai" value="true">
         ${el:defineSearchResultList('grupoPaiList', 'to.searcher', 'grupoPaiList',  'request', pageContext)}
	          <div class='formField' >
	            <label><bean:message key="grupo.pai"/></label>            
	             	<html:select  property="idPai" >
						<html:option value=""></html:option>	
						<logic:present name="grupoPaiList">	
						<logic:iterate name="grupoPaiList" id="grupo" >
							<html:option value="${grupo.idGrupo}" >${el:write('grupo.idGrupo',pageContext)}- ${el:write('grupo.nome',pageContext)}</html:option>
						</logic:iterate>								
						</logic:present>
					</html:select>
	            
	        </div>
        </logic:equal>
        <hr size="1">
        <div class='formButton'>    
          <a onclick="GruposForm" class="linkButton">  <bean:message key="app.button.reset"/></a>
      		 &nbsp;
		     <a onclick="javascript:gravar();" class="linkButton">  <bean:message key="app.button.store"/></a>
          </div>
            
    </div>
    </html:form>
   
      
<script type="text/javascript">
 // <!--
   
  var action= '<html:rewrite page="/gruposAction.do"/>';
  var nForm =  'GruposForm';

 function gravar(){	 
	 executeForm(nForm, action, 'gravar');
 }
 
  //-->
</script>
</body>
</html>